import {NgModule} from '@angular/core';
import {Routes, RouterModule} from '@angular/router';
import {HomeComponent} from './home.component';
import {LatestComponent} from './latest/latest.component';
import {HotComponent} from './hot/hot.component';
import {DetailComponent} from './detail/detail.component';

const routes: Routes = [
  {
    path: '',
    component: HomeComponent,
    children: [
      {
        path: '',
        redirectTo: 'latest',
        pathMatch: 'full'
      },
      {
        path: 'latest',
        component: LatestComponent,
      },
      {
        path: 'hot',
        component: HotComponent
      },
      {
        path: 'latest/detail/:id',
        component: DetailComponent,
      },
      {
        path: 'hot/detail/:id',
        component: DetailComponent,
      }
    ],
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})
export class HomeRoutingModule {
}
